<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>Title</title>
    
    <style>
      button {
        margin-left: 10px;
      }
    </style>
  </head>
  
  <body>
    <div id="app">
      <!-- HTML中方法无参可不添加()调用 -->
      <button @click="addCount">{{obj.count}}</button>
    </div>
  </body>
  
  <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
  
  <script>
    Vue.createApp({
      data() {
        return {
          obj: {
            count: 0
          }
        };
      },
      methods: {
        addCount() {
          // this指向该组件实例，methods内定义的方法被添加到该组件实例上
          this.increment();
        },
        increment() {
          // 深层次响应
          this.obj.count++;
        }
      }
    }).mount('#app');
  </script>
</html>